#include <iostream>
#include <memory>
#include <unistd.h>
#include "ThreadPool.hpp"
#include "Task.hpp"

using namespace ThreadPoolModule;

int main()
{
    ENABLE_CONSOLE_LOG();

    tasks.push_back(MySql);
    tasks.push_back(UpLoad);
    tasks.push_back(DownLoad);

    std::shared_ptr<ThreadPool<task_t>> tp = std::make_shared<ThreadPool<task_t>>(3);

    tp->Start();

    int cnt = 0;
    while(cnt < 6)
    {
        tp->Equeue(tasks[cnt % 3]);
        cnt++;
        sleep(1);
    }

    tp->Stop();

    sleep(3);

    tp->Wait();

    return 0;
}